<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<title>{$title}</title>
<script type="text/javascript" src="App-Contents/Scripts/s.js"></script>
<script type="text/javascript" src="App-Contents/Scripts/f.js"></script>
<script type="text/javascript" src="App-Contents/Scripts/f.e.js"></script>
<script type="text/javascript" src="App-Contents/Scripts/f.ajax.js"></script>
<style type="text/css">
body{ font-size:12px; color:#333}
label{ display:block; height:30px; line-height:30px; margin-top:10px; font-weight:bold}
span.label{ font-weight:bold;}
input.text{ color:green; border:1px #999 solid; height:18px; line-height:18px}
span.red{ color:red}
span.green{ color:green}
div{ line-height:150%}
</style>
</head>
<body>
<form action="install.asp?a=docreatetable" method="post" name="dbsetting">
<div id="step">
    <h2>欢迎使用MoBlog安装程序。</h2>
    <h3>常用组件检测</h3>
    <hr />
    <table width="800">
		<tr><td width="150">组件</td><td>用途</td><td>是否必需</td><td>是否可用</td></tr>
		<tr><td>Scripting.FileSystemObject</td><td>文件系统操作</td><td>是</td><td><eq name="FSO" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>Scripting.Dictionary</td><td>字典类</td><td>是</td><td><eq name="IDCT" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>ADODB.STREAM</td><td>文件读写操作</td><td>是</td><td><eq name="STREAM" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>ADODB.CONNECTION</td><td>数据库连接</td><td>是</td><td><eq name="CONNECTION" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>ADODB.RECORDSET</td><td>数据集</td><td>是</td><td><eq name="RECORDSET" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>ADOX.Catalog</td><td>创建ACCESS数据库</td><td>否（安装ACCESS必须）</td><td><eq name="Catalog" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>Persits.Jpeg</td><td>图片处理</td><td>否（缺失将无法生成缩略图）</td><td><eq name="Jpeg" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>JMail.Message</td><td>邮件发送</td><td>否（缺失将无法发送邮件）</td><td><eq name="Jmail" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>JMail.SMTPMail</td><td>邮件发送</td><td>否</td><td><eq name="SMTP" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>JMail.POP3</td><td>邮件接收</td><td>否</td><td><eq name="POP3" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
		<tr><td>Microsoft.XMLDOM</td><td>XML操作</td><td>否（XMLPACK类用）</td><td><eq name="XMLDOM" value="yes"><span class="green">是</span></else><span class="red">否</span></eq></td></tr>
	</table>
    <h3>文件（夹）可读写检测-安装程序必须（都可写安装程序才能继续下去）</h3>
    <hr />
    配置文件目录-<eq name="AppConf" value="yes"><span class="green">可写</span></else><span class="red">不可写</span></eq><br />
    数据库目录-<eq name="AppData" value="yes"><span class="green">可写</span></else><span class="red">不可写</span></eq>（如果您使用MSSQL数据库，可忽略本项的检查结果）<br />
    安装程序配置文件目录-<eq name="InstallConf" value="yes"><span class="green">可写</span></else><span class="red">不可写</span></eq><br />
    <h3>文件（夹）可读写检测-非安装程序必须</h3>
    <hr />
    相册目录-<eq name="AppAlbum" value="yes"><span class="green">可写</span></else><span class="red">不可写</span></eq><br />
    相册目录-<eq name="AppAlbumCreate" value="yes"><span class="green">可创建子文件夹</span></else><span class="red">不可创建子文件夹</span></eq><br />
    附件目录-<eq name="AppAttachments" value="yes"><span class="green">可写</span></else><span class="red">不可写</span></eq><br />
    图片上传目录-<eq name="AppImages" value="yes"><span class="green">可写</span></else><span class="red">不可写</span></eq>
    <br />
    <br /><a href="#" onclick="Goto('createtable');">下一步</a>
</div>
<div id="createtable">
    <h3>数据库配置</h3>
    <hr />
    <span>数据库类型：</span><input type="radio" name="dbtype" value="access" checked="checked" onclick="document.getElementById('setting_access').style.display='block';document.getElementById('setting_mssql').style.display='none';" /> ACCESS&nbsp;
    <input type="radio" name="dbtype" value="mssql" onclick="document.getElementById('setting_access').style.display='none';document.getElementById('setting_mssql').style.display='block';" /> MSSQL2000<br />
    <div id="setting_access"><label>数据库路径：</label><input type="text" name="path" class="text" value="App-Contents/data/{$path}.mdb" size="40" /></div>
    <div id="setting_mssql" style="display:none">
    <label>数据库服务器：</label><input type="text" name="server" class="text" value="(local)" size="40" /> *本机可直接写(local)，远程数据库请写下IP(或主机名)和端口号<br />
    <label>数据库登录名：</label><input type="text" name="username" class="text" value="" size="40" /> *登录数据库使用的用户名<br />
    <label>数据库登录密码：</label><input type="text" name="password" class="text" value="" size="40" /><br />
    <label>数据库名称：</label><input type="text" name="dbname" class="text" value="moblog" size="40" /> *博客要使用的数据库名，必须是已存在的数据库 <a href="#" onclick="CheckConnection();">测试数据库连接</a> <span id="msg"></span><br />
    </div>
    <label>数据表前缀：</label><input type="text" name="prex" class="text" value="Mo_" size="40" /> *为了同一数据库运行多套程序而设置的数据表前缀
    <br /><br />
    <a href="#" onclick="Goto('step');">上一步</a>
    &nbsp; &nbsp; <a href="#" onclick="Goto('installsetting');">下一步</a><br /><br />
</div>
<div id="installsetting">
    <h3>您的数据库已经配置成功，请设置管理员账户信息</h3>
    <hr />
    <label>管理员用户名：</label><input type="text" name="adm_username" class="text" value="moblog" size="40" /> *不能为空且少于20个字符，支持数字、字母以及下划线<br />
    <label>管理员密码：</label><input type="password" name="adm_password" class="text" value="" size="40" /> <br />
    <label>再次输入密码：</label><input type="password" name="adm_repassword" class="text" value="" size="40" /><br />
    <br />
    <a href="#" onclick="Goto('createtable');">上一步</a>
    &nbsp; &nbsp; <a href="#" onclick="if(!window.confirm('确定要以您选择的配置安装博客吗？'))return;SaveSetting();">下一步</a><br /><br />
    <div id="result"></div>
</div>
<div id="complete">
	恭喜，MoBlog安装完成！<a href="{$$MO_ROOT}?m=login&a=login">立即管理</a> &nbsp; &nbsp;<a href="?a=deleteinstall" onclick="return window.confirm('确定要删除安装程序吗？')">删除安装程序</a><br />
    建议删除安装程序，或者您可以手动删除install.asp以及Install文件夹！
</div>
</form>
<script type="text/javascript">
Goto("step");
function Goto(id){
	F("body > form > div").css({"display":"none"});
	F("#" + id).css({"display":"block"});
}
function SaveSetting(){
	var frm = 	document.forms["dbsetting"];
	F("#result").html("正在保存配置。。。");
	F.ajax({
		form:frm,
		succeed:function(msg){
			F("#result").html(msg);
			if(msg.indexOf("数据库配置成功")>=0){
				Goto("complete");
			}
		},
		error:function(a,b){
			F("#result").html("服务器错误：" + a + b.responseText);
		}
	});
}
function CheckConnection(){
	var frm = 	document.forms["dbsetting"];
	if(frm["server"].value==""){alert("请输入数据库所在服务器");return;}
	if(frm["username"].value==""){alert("请输入数据库登录名");return;}
	if(frm["password"].value==""){alert("请输入数据库登录密码");return;}
	if(frm["dbname"].value==""){alert("请输入数据库名");return;}
	F("#msg").html("正在检测数据库是否可用。。。");
	F.ajax({
		url:"install.asp?a=dbconnecttest",
		method:"post",
		data:"server=" + encodeURIComponent(frm["server"].value) + "&username=" + encodeURIComponent(frm["username"].value) + "&password=" + encodeURIComponent(frm["password"].value) + "&dbname=" + encodeURIComponent(frm["dbname"].value),
		succeed:function(msg){
			F("#msg").html(msg);
		},
		error:function(a,b){
			F("#msg").html("服务器错误：" + a + b.responseText);
		}
	});
}
</script>
</body>
</html>